package com.wtz.temptest;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author tiezhu
 * Company dtstack
 * Date 2020/8/26 星期三
 */
public class TestTimer {
    private static long count;
    public static void main(String[] args) {
       testTimerSchedule();
    }

    private static void testTimerSchedule() {
        for (int i = 0; i < 10; i++) {
            new Timer("timer - " + i).schedule(new TimerTask() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName() + " is Running" + "\n current count is " + count++);
                }
            }, 1000);
        }
    }
}
